package com.bestcem.xm.user.dao.mapper;

import com.bestcem.xm.user.entity.mysql.OrganizationQuotainfo;
import com.bestcem.xm.user.entity.pojo.QuotaInfoQueryDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrganizationQuotainfoMapper {

    /**
     * 按主键删除
     *
     * @param quotainfoId
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    int deleteByPrimaryKey(String quotainfoId);

    /**
     * 插入
     *
     * @param organizationQuotainfo
     * @return java.lang.String
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    int insertSelective(OrganizationQuotainfo organizationQuotainfo);

    /**
     * 按主键查询
     *
     * @param quotainfoId
     * @return java.lang.String
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    OrganizationQuotainfo selectByPrimaryKey(String quotainfoId);

    /**
     * 按主键更新
     *
     * @param organizationQuotainfo
     * @return java.lang.String
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    int updateByPrimaryKeySelective(OrganizationQuotainfo organizationQuotainfo);

    /**
     * 统计配额
     *
     * @param quotaInfoQueryDO
     * @return java.lang.String
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    long countQuataInfo(QuotaInfoQueryDO quotaInfoQueryDO);

    /**
     *查询配额
     *
     * @param quotaInfoQueryDO
     * @param orgList
     * @param currentPage
     * @param size
     * @return java.util.List<com.bestcem.xm.user.entity.pojo.OrganizationQuotainfo>
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    List<OrganizationQuotainfo> selectByQuery(@Param("query") QuotaInfoQueryDO quotaInfoQueryDO,@Param("orgList") List<String> orgList, @Param("offset")Integer currentPage, @Param("size") Integer size);

    /**
     * 分页查询配额
     *
     * @param orgId
     * @param currentPage
     * @param size
     * @return java.util.List<com.bestcem.xm.user.entity.pojo.OrganizationQuotainfo>
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    List<OrganizationQuotainfo> listPageByOrgId(@Param("orgId") String orgId, @Param("offset") Integer currentPage, @Param("size") Integer size);

    /**
     * 统计
     *
     * @param orgId
     * @return long
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    long countByOrgId(@Param("orgId") String orgId);

    /**
     * 按租户查询
     *
     * @param orgId
     * @return java.lang.String
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    OrganizationQuotainfo getByOrgId(@Param("orgId")String orgId);

    /**
     * 更新配额
     *
     * @param organizationQuotainfo
     * @return int
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    int updateQuotaConsumption(OrganizationQuotainfo organizationQuotainfo);

    /**
     * 查询配额
     *
     * @param organizationQuotainfo
     * @return java.util.List<com.bestcem.xm.user.entity.pojo.OrganizationQuotainfo>
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    List<OrganizationQuotainfo> selectBySelective(OrganizationQuotainfo organizationQuotainfo);

    /**
     * 查询配额
     *
     * @param quotaInfoQueryDO
     * @return java.util.List<com.bestcem.xm.user.entity.pojo.OrganizationQuotainfo>
     * @author Linzhijian <zhijian.lin@idiaoyan.com>
     * @date 2022/09/28 15:50
     */
    List<OrganizationQuotainfo> listQuataInfo(QuotaInfoQueryDO quotaInfoQueryDO);
}